<!DOCTYPE>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
 <link href="__PUBLIC__/assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="__PUBLIC__/css/style.css"/>       
        <link href="__PUBLIC__/assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="__PUBLIC__/assets/css/ace.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/font/css/font-awesome.min.css" />
        <!--[if lte IE 8]>
		  <link rel="__PUBLIC__/stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="__PUBLIC__/js/jquery-2.1.3.min.js"></script>
		<script src="__PUBLIC__/assets/js/typeahead-bs2.min.js"></script>   
        <script src="__PUBLIC__/js/lrtk.js" type="text/javascript" ></script>		
		<script src="__PUBLIC__/assets/js/jquery.dataTables.min.js"></script>
		<script src="__PUBLIC__/assets/js/jquery.dataTables.bootstrap.js"></script>
    <script src="__PUBLIC__/assets/js/bootstrap.min.js"></script>
        <script src="__PUBLIC__/assets/layer/layer.js" type="text/javascript" ></script>          
        <script src="__PUBLIC__/assets/dist/echarts.js"></script>
      
<title>会员管理</title>
</head>

<body>

      <!--列表样式-->
      <div class="grading_list">
       <!-- <div class="type_title">全部会员等级列表</div> -->
       
       <!-- 搜索栏？ -->
       <form class="form-inline" action="{:U('Admin/User/index')}" method="post">
        <div class="form-group">
          <input type="text" name="name" class="form-control" id="exampleInputName2" placeholder="请输入用户名">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
      </form>
      <!-- 搜索栏结束 -->
         <div class="table_menu_list">
       <table class="table table-striped table-bordered table-hover" id="sample-table">
		<thead>
		 <tr>
<!-- 				<th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th> -->
				<th width="80">ID</th>
				<th width="100">用户名</th>
				<!-- <th width="80">性别</th>
				<th width="120">手机</th> -->
				<th width="150">邮箱</th>
				
				<th width="180">加入时间</th>
               <!--  <th width="100">等级</th>
                <th width="100">积分</th> -->
				<th width="70">状态</th>                
				<th width="250">操作</th>
			</tr>
		</thead>
	<tbody>
  <foreach name="list" item="val">
		<tr id="user_com{$val.id}">
          <!-- <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td> -->
          <td>{$val.id}</td>
          <td>{$val.username}</td>
          <!-- <td>男</td>
          <td>13000000000</td> -->
          <td>{$val.email}</td>         
          <td>{$val.addtime}</td>
       <!--    <td>普通用户</td>
          <td class="text-l">345</td> -->
          <td class="td-status"><span class="label label-success radius" id="status_{$val.id}">{$val.status}</span></td>
          <td class="td-manage" width="30%">
          <a href="javascript:;" title="停用"  class="btn btn-xs btn-success" onclick="user_j({$val.id})"><i class="fa fa-check bigger-120"></i>禁用</a> 
          <a href="javascript:;" title="停用"  class="btn btn-xs btn-success" onclick="user_q({$val.id})"><i class="fa fa-check bigger-120"></i>启用</a> 
          <a title="删除" href="javascript:;" class="btn btn-xs btn-warning" onclick="user_del({$val.id})" ><i class="fa fa-trash  bigger-120"></i>删除</a>
          <a title="查看" href="{:U('Admin/User/show')}?id={$val.id}"  class="btn btn-xs btn-warning" ><i class="fa fa-trash  bigger-120"></i>查看</a>
          </td>
		</tr>
    </foreach>
      </tbody>
	</table>
  <!-- 分页按钮  -->
    <div id="btnBox" align="right">{$show}</div>
   </div>
      </div>
   </div> 
  </div>
</div>
</body>
<script>
    //分页按钮
     $('#btnBox').children().children().unwrap().wrap('<li></li>').parent().wrapAll('<ul class="pagination"></ul>');
    // 给当前页码高亮显示
    $('#btnBox span').parent().addClass('active');
   //点击禁用时调用
   function user_j(id){
      $.get("{:U('Admin/User/user_j')}",{'id':id},function(data){
        if(data == '禁用成功'){
          alert(data);
          var status = '#status_'+id;
          $(status).text('已禁用');
        }else{
          alert(data);
        }
      });
   }
   //点击启用时调用
   function user_q(id){
      $.get("{:U('Admin/User/user_q')}",{'id':id},function(data){
        if(data == '启用成功'){
          alert(data);
          var status = '#status_'+id;
          $(status).text('已启用');
        }else{
          alert(data);
        }
      });
   }
   //取得当前用户状态
    var status = {$Think.session.admin_status};
   //点击删除时调用
   function user_del(id){
     if(status == '2'){
      if(confirm('你确定要删除此用户吗') == true){
           $.get("{:U('Admin/User/user_del')}",{'id':id},function(data){
            if(data == '删除成功'){
                var user = '#user_com'+id;
                $(user).remove();
            }else{
               alert(data);
            }
        });    
    }
    }else{
          alert('无权限');
        }
   }
</script>
</html>
